import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '测站编码',
    align:"center",
    dataIndex: 'stcd'
   },
   {
    title: '测站名称',
    align:"center",
    dataIndex: 'stnm'
   },
   {
    title: '河流名称',
    align:"center",
    dataIndex: 'rvnm'
   },
   {
    title: '水系名称',
    align:"center",
    dataIndex: 'hnnm'
   },
   {
    title: '流域名称',
    align:"center",
    dataIndex: 'bsnm'
   },
   {
    title: '经度',
    align:"center",
    dataIndex: 'lgtd'
   },
   {
    title: '纬度',
    align:"center",
    dataIndex: 'lttd'
   },
   {
    title: '站址',
    align:"center",
    dataIndex: 'stlc'
   },
   {
    title: '行政区划码',
    align:"center",
    dataIndex: 'addvcd'
   },
   {
    title: '基面名称',
    align:"center",
    dataIndex: 'dtmnm'
   },
   {
    title: '基面高程',
    align:"center",
    dataIndex: 'dtmel'
   },
   {
    title: '基面修正值',
    align:"center",
    dataIndex: 'dtpr'
   },
   {
    title: '站类',
    align:"center",
    dataIndex: 'sttp'
   },
   {
    title: '报讯等级',
    align:"center",
    dataIndex: 'frgrd'
   },
   {
    title: '建站年月',
    align:"center",
    dataIndex: 'esstym'
   },
   {
    title: '始报年月',
    align:"center",
    dataIndex: 'bgfrym'
   },
   {
    title: '隶属行业单位',
    align:"center",
    dataIndex: 'atcunit'
   },
   {
    title: '信息管理单位',
    align:"center",
    dataIndex: 'admauth'
   },
   {
    title: '交换管理单位',
    align:"center",
    dataIndex: 'locality'
   },
   {
    title: '测站岸别',
    align:"center",
    dataIndex: 'stbk'
   },
   {
    title: '测站方位',
    align:"center",
    dataIndex: 'stazt'
   },
   {
    title: '至河口距离',
    align:"center",
    dataIndex: 'dstrvm'
   },
   {
    title: '集水面积',
    align:"center",
    dataIndex: 'drna'
   },
   {
    title: '拼音码',
    align:"center",
    dataIndex: 'phcd'
   },
   {
    title: '启用标志',
    align:"center",
    dataIndex: 'usfl'
   },
   {
    title: '备注',
    align:"center",
    dataIndex: 'comments'
   },
   {
    title: '时间戳',
    align:"center",
    dataIndex: 'moditime',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: 'flag',
    align:"center",
    dataIndex: 'flag'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '测站编码',
    field: 'stcd',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入测站编码!'},
          ];
     },
  },
  {
    label: '测站名称',
    field: 'stnm',
    component: 'Input',
  },
  {
    label: '河流名称',
    field: 'rvnm',
    component: 'Input',
  },
  {
    label: '水系名称',
    field: 'hnnm',
    component: 'Input',
  },
  {
    label: '流域名称',
    field: 'bsnm',
    component: 'Input',
  },
  {
    label: '经度',
    field: 'lgtd',
    component: 'InputNumber',
  },
  {
    label: '纬度',
    field: 'lttd',
    component: 'InputNumber',
  },
  {
    label: '站址',
    field: 'stlc',
    component: 'Input',
  },
  {
    label: '行政区划码',
    field: 'addvcd',
    component: 'Input',
  },
  {
    label: '基面名称',
    field: 'dtmnm',
    component: 'Input',
  },
  {
    label: '基面高程',
    field: 'dtmel',
    component: 'InputNumber',
  },
  {
    label: '基面修正值',
    field: 'dtpr',
    component: 'InputNumber',
  },
  {
    label: '站类',
    field: 'sttp',
    component: 'Input',
  },
  {
    label: '报讯等级',
    field: 'frgrd',
    component: 'Input',
  },
  {
    label: '建站年月',
    field: 'esstym',
    component: 'Input',
  },
  {
    label: '始报年月',
    field: 'bgfrym',
    component: 'Input',
  },
  {
    label: '隶属行业单位',
    field: 'atcunit',
    component: 'Input',
  },
  {
    label: '信息管理单位',
    field: 'admauth',
    component: 'Input',
  },
  {
    label: '交换管理单位',
    field: 'locality',
    component: 'Input',
  },
  {
    label: '测站岸别',
    field: 'stbk',
    component: 'Input',
  },
  {
    label: '测站方位',
    field: 'stazt',
    component: 'InputNumber',
  },
  {
    label: '至河口距离',
    field: 'dstrvm',
    component: 'InputNumber',
  },
  {
    label: '集水面积',
    field: 'drna',
    component: 'InputNumber',
  },
  {
    label: '拼音码',
    field: 'phcd',
    component: 'Input',
  },
  {
    label: '启用标志',
    field: 'usfl',
    component: 'Input',
  },
  {
    label: '备注',
    field: 'comments',
    component: 'Input',
  },
  {
    label: '时间戳',
    field: 'moditime',
    component: 'DatePicker',
  },
  {
    label: 'flag',
    field: 'flag',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}